package com.lingnan.entity.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import lombok.Data;
import jakarta.validation.constraints.*;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;


@Data
public class JobSeeker {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long userId;
    @NotBlank(message = "真实姓名不能为空")
    @Size(max = 50, message = "姓名长度不能超过50个字符")
    private String realName;

    @Min(value = 0, message = "性别必须为0-2之间")
    @Max(value = 2, message = "性别必须为0-2之间")
    private Integer gender;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    /*@JsonDeserialize(using = LocalDateDeserializer.class)
    @JsonSerialize(using = LocalDateSerializer.class)*/
    private Date birthDate;

    @Size(max = 50, message = "学历长度不能超过50个字符")
    private String education;

    @Min(value = 0, message = "工作经验不能为负数")
    private Integer workExp;

    @Size(max = 100, message = "求职意向长度不能超过100个字符")
    private String jobIntent;

    private String skills;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdAt;
    private Long updateId;

    // 非数据库字段，用于关联查询
    @TableField(exist = false)
    private List<Resume> resumes;

    @TableField(exist = false)
    private List<JobApplication> applications;

    @TableField(exist = false)
    private UserAccount userAccount;
}